<template>
    <el-descriptions border :column="2">
        <el-descriptions-item :span=2 label="单位名称　　　　　"><el-text>{{ ruleForm.name }}</el-text></el-descriptions-item>
        <el-descriptions-item :span=2 label="纳税人识别号　　　"><el-text>{{ ruleForm.tax_id }}</el-text></el-descriptions-item>
        <el-descriptions-item :span=2 label="地址　　　　　　　"><el-text>{{ ruleForm.address }}</el-text></el-descriptions-item>
        <el-descriptions-item :span=2 label="电话　　　　　　　"><el-text>{{ ruleForm.mobile }}</el-text></el-descriptions-item>
        <el-descriptions-item :span=2 label="开户银行　　　　　"><el-text>{{ ruleForm.bank }}</el-text></el-descriptions-item>
        <el-descriptions-item :span=2 label="开户行号　　　　　"><el-text>{{ ruleForm.bank_number }}</el-text></el-descriptions-item>
        <el-descriptions-item :span=2 label="银行账号　　　　　"><el-text>{{ ruleForm.bank_account }}</el-text></el-descriptions-item>
        <el-descriptions-item label="邮箱　　　　　　　"><el-text>{{ ruleForm.email }}</el-text></el-descriptions-item>
        <el-descriptions-item label="邮政编码　　　　　"><el-text>{{ ruleForm.postal_code }}</el-text></el-descriptions-item>
        <el-descriptions-item label="上传公司营业执照　">
            <el-button :type="ruleForm.b_business_file ? 'primary' : 'info'"  @click="onShowFile(ruleForm.business_file)"> 查看 </el-button>
        </el-descriptions-item>
        <el-descriptions-item label="上传法人身份证　　">
            <el-button :type="ruleForm.b_idcard_file ? 'primary' : 'info'"  @click="onShowFile(ruleForm.idcard_file)"> 查看 </el-button>
        </el-descriptions-item>
        <el-descriptions-item label="企业法人　　　　　"><el-text>{{ ruleForm.legal }}</el-text></el-descriptions-item>
        <el-descriptions-item label="企业法人联系电话　"><el-text>{{ ruleForm.legal_mobile }}</el-text></el-descriptions-item>
        <el-descriptions-item label="代理人　　　　　　"><el-text>{{ ruleForm.agent }}</el-text></el-descriptions-item>
        <el-descriptions-item label="代理人联系电话　　"><el-text>{{ ruleForm.agent_mobile }}</el-text></el-descriptions-item>
        <el-descriptions-item label="上传委托代理授权书">
            <el-button :type="ruleForm.b_authorize_file ? 'primary' : 'info'"  @click="onShowFile(ruleForm.authorize_file)"> 查看 </el-button>
        </el-descriptions-item>
        <el-descriptions-item label="上传代理人身份证　">
            <el-button :type="ruleForm.b_agent_idcard_file ? 'primary' : 'info'"  @click="onShowFile(ruleForm.agent_idcard_file)"> 查看 </el-button>
        </el-descriptions-item>
        <el-descriptions-item label="上传合同扫描件　　">
            <el-button :type="ruleForm.contract_canned ? 'primary' : 'info'"  @click="onShowFile(ruleForm.contract_canned)"> 查看 </el-button>
        </el-descriptions-item>
    </el-descriptions>

    <el-dialog v-model="isShowFile" title="文件" class="m0" width="80%" draggable>
        <component :is="showFile" :data="files"/>
    </el-dialog>
</template>
  
<script lang="ts" setup>
import { ref, watch } from 'vue';
import http from '../util/request';
import showFile from '@/components/showFile.vue'
import { ElMessage } from 'element-plus';
const id:any = ref(0)
const ruleForm = ref<any>({project:{}})
const isShowFile = ref<boolean>(false)
const files = ref('')
const getData = () => {
    if(id.value == 0){
        return;
    }
    http.get('/team/'+id.value).then((response:any)=>{
        if(response.data.data){
            ruleForm.value = response.data.data
        }
    })
}

const props = defineProps<{
    data:any
}>()

watch(props,()=>{
    id.value = props.data
    getData()
},{ immediate: true })

const onShowFile = (file:string) => {
    if(!file){
        ElMessage.error('未上传文件');return
    }
    files.value = file
    isShowFile.value = true
}
</script>
<style scoped>
.contract{height: calc(100vh - 25vh);overflow-y: scroll;}
</style>
